layui.use(['form','carousel'],function() {
	const layer = layui.layer,$ = layui.jquery,util = layui.util,form = layui.form, carousel = layui.carousel;

	carousel.render({
		elem: '#ID-carousel-demo-1',
		interval: 1800,
		anim: 'fade',
		width: 'auto',
		height: '120px'
	});

	document.getElementById('fullscreen-button').addEventListener('click', toggleFullScreen);
	//全屏参数
	function toggleFullScreen() {
		if (!document.fullscreenElement) {
			// 进入全屏
			document.documentElement.requestFullscreen();
		} else {
			// 退出全屏
			if (document.exitFullscreen) {
				document.exitFullscreen();
			}
		}
	}

	//点击左右两侧菜单栏
	$(document).on("click",'.elsic-menus-box',function (){
		$('.elsic-menus-child-box').hide();
		$(this).parent().find('.elsic-menus-child-box').show();
	});
	//点击空白地方，关闭子菜单
	$(document).on("click",function (e){
		const clickArea = $('.elsic-menus');
		const target = $(e.target);
		if (!target.is(clickArea) && !$.contains(clickArea[0],target[0])&& !$.contains(clickArea[1],target[0])){
			$('.elsic-menus-child-box').hide();
		}
	})

	$(document).on("click",'#personClick',function (){
		$('.elsic-person-info-nav').toggle();
	});

	$(document).on("click",'#logout',function (){
		$('.elsic-person-info-nav').toggle();
		$('#logoutLayer').show();
	});

	$(document).on("click",'#changePwd',function (){
		$('.elsic-person-info-nav').toggle();
		$('#changePwdLayer').show();
	});

	$(document).on("click",'.closeLogoutLayer',function (){
		$('#logoutLayer').hide();
	});
	$(document).on("click",'.closeChangePwdLayer',function (){
		$('#changePwdLayer').hide();
	});

	form.on('submit(changePwdForm)',function (e){
		layer.alert(JSON.stringify(e.field));
	})

	function getToday(){
		// 创建一个新的Date对象，默认为当前日期和时间
		const now = new Date();
		// 获取日期的方法
		const date = now.getDate(); // 当月的某天（1-31）
		const month = now.getMonth() + 1; // 月份（0-11）中，+1因为getMonth()返回的月份从0开始
		const year = now.getFullYear(); // 4位年份
		const hour = now.getHours();
		const min = now.getMinutes();

		// 获取星期的方法
		const dayOfWeek = now.getDay(); // 星期几（0-6）中，0代表星期日
		const daysOfWeek = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
		const dayName = daysOfWeek[dayOfWeek];
		return `${year}年${month}月${date}日 ${dayName} ${hour}:${min}`
	}

	$('#today').html(getToday());

});
